﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DatabasePwd
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public class JSONDescClassItem
        {


            public string descName { get; set; }
            public string id { get; set; }
            public List<JSONDescItem> items { get; set; }
        }

        public class JSONDescItem
        {


            public string classId { get; set; }
            public string id { get; set; }
            public string name { get; set; }
            public string value { get; set; }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            ArrayList a = new ArrayList() {
            "1.1",
            "1.3",
            "1.2",
            };
            var b = a.ToArray().Select(p => Convert.ToDouble(p)).ToList();
            b.Sort();

            string st = "[{id:\"4707218597914ad184375af3a32fcd0b\",descName:\"人物信息\",items:[{id:\"44d3906d664b436a9c0e1fc08dfbf1b1\",name:\"修为\",value:\"1\",classId:\"\"},{id:\"e25d9a6bf1654648a4f037de38808ad8\",name:\"声望\",value:\"2\",classId:\"\"}]},{id:\"78d196c34b3f43a5936e3e5d060cd46a\",descName:\"装备信息\",items:[{id:\"053fc487ed994a9998727af707fb0888\",name:\"武器\",value:\"3\",classId:\"\"},{id:\"c0a1543a92504aedbdc278e5106bce7d\",name:\"衣服\",value:\"4\",classId:\"\"},{id:\"16090eb362ea4550aa07d7e77cf898ad\",name:\"帽子\",value:\"5\",classId:\"\"},{id:\"874ae7d51dce41fc842d5be6142ce762\",name:\"腰带\",value:\"6\",classId:\"\"},{id:\"beedb08180374d5cb78d5d4b529b3f03\",name:\"腰坠\",value:\"7\",classId:\"\"},{id:\"bc6c97abef4a404691f11dc3322968e9\",name:\"鞋子\",value:\"8\",classId:\"\"},{id:\"b60a01ed8115455aa11c3987317b68d3\",name:\"项链\",value:\"9\",classId:\"\"},{id:\"7d1c0abcd923491ca523706e373d9635\",name:\"护腕\",value:\"44\",classId:\"\"},{id:\"89495e2a7d9548f7be08523f72a0158b\",name:\"戒指\",value:\"44\",classId:\"\"},{id:\"6ea54f13aa1d4bf68dcd6006e8b51e23\",name:\"法宝\",value:\"44\",classId:\"\"}]},{id:\"4ccda797f7524296a4a313e81406972a\",descName:\"技能信息\",items:[{id:\"f8461d1890b14d23babd0b5ad5e56759\",name:\"门派技能\",value:\"44\",classId:\"\"},{id:\"90808ca809394e938c030c5f967dfab0\",name:\"生产技能\",value:\"44\",classId:\"\"},{id:\"1fe8f0d1f4c640189f68afa37b81b9be\",name:\"法宝特技\",value:\"\",classId:\"\"},{id:\"9ca9521ac0f34846b696887735dc5e10\",name:\"其他技能\",value:\"\",classId:\"\"}]},{id:\"af53d9702bd14c6a96c13c3fdd69c2fe\",descName:\"其他信息\",items:[{id:\"60123a1b333e442b8cb023647480fbca\",name:\"宠物信息\",value:\"44\",classId:\"\"},{id:\"56c0018f3b8344119a27bb081023d415\",name:\"仓库信息\",value:\"44\",classId:\"\"},{id:\"28923b46600a4f1d81e93d540ffea727\",name:\"包裹信息\",value:\"44\",classId:\"\"},{id:\"64e50d21d1294301be5a72c22aca9fd1\",name:\"银两\",value:\"44\",classId:\"\"},{id:\"f960637f3d26447bb63e14d9e734f14b\",name:\"其他信息\",value:\"44\",classId:\"\"}]}]";
            var descClassItem = Newtonsoft.Json.JsonConvert.DeserializeObject<JSONDescClassItem[]>(st);
            Hashtable gameDesc = null;
            ArrayList gameDescList = null;


            if (descClassItem != null && descClassItem.Length > 0)
            {
                gameDesc = new Hashtable();
                gameDescList = new ArrayList();
                StringBuilder sbRegInfo = new StringBuilder();
                foreach (var desItem in descClassItem)
                {
                    foreach (var desChildItem in desItem.items)
                    {
                        sbRegInfo.Append(String.Format("{0}：{1}{2}", desChildItem.name, desChildItem.value, Environment.NewLine));
                        if (!gameDesc.ContainsKey(desChildItem.id))
                        {
                            gameDesc.Add(desChildItem.id, desChildItem.value);
                            gameDescList.Add(desChildItem.name);
                        }
                    }
                }
                var h = sbRegInfo.ToString();
            }
        }
    }
}
